Generating Fixtures for JavaScript Unit Testing
نویسندگان
چکیده
In today’s web applications, JavaScript code interacts with the Document Object Model (DOM) at runtime. This runtime interaction between JavaScript and the DOM is errorprone and challenging to test. In order to unit test a JavaScript function that has read/write DOM operations, a DOM instance has to be provided as a test fixture. This DOM fixture needs to be in the exact structure expected by the function under test. Otherwise, the test case can terminate prematurely due to a null exception. Generating these fixtures is challenging due to the dynamic nature of JavaScript and the hierarchical structure of the DOM. We present an automated technique, based on dynamic symbolic execution, which generates test fixtures for unit testing JavaScript functions. Our approach is implemented in a tool called CONFIX. Our empirical evaluation shows that CONFIX can effectively generate tests that cover DOM-dependent paths. We also find that CONFIX yields considerably higher coverage compared to an existing JavaScript input generation technique. Keywords—Test fixture, test generation, dynamic symbolic execution, concolic execution, DOM, JavaScript, web applications
منابع مشابه
Design and Implementation of a Constraint-Based Test Case Generator with Test Fixture Computation
In this study, we design and implement a constraint-based test case generator. Test cases for methodlevel unit-testing can be generated automatically from UML class diagrams and OCL specifications. A test case includes test data (test inputs and expected outputs), and test fixtures. We adopt a constraint logic graph approach to generating test data, and a finite model reasoning approach to gene...
متن کاملExploration of the Customized Fixtures for the Evaluation of Three-point Bending Strength of Dental Resin Composites
Introduction: This study aimed to devise customized fixtures for the evaluation of three-point bending strength (TPBS) of resin-based dental composites (RBCs). Materials and Methods: A cube-shaped jig made out of wood with dimensions of 105×105×101 mm was prepared in this study. A 20-mm-diameter hole was made in the center of the wooden jig. In addition, a stai...
متن کاملAutomatic Unit Test Generation and Execution for JavaScript Program through Symbolic Execution
JavaScript is expected to be a programming language of even wider use, considering demands for more interactive web/mobile applications. While reliability of JavaScript code will be of more importance, testing techniques for the language remain insufficient compared to other languages. We propose a technique to automatically generate high-coverage unit tests for JavaScript code. The technique m...
متن کاملAutomated Unit Testing of JavaScript Code through Symbolic Executor SymJS
JavaScript is expected to be a programming language of even wider use, considering demands for more interactive web/mobile applications and deployment in server-side software. While reliability of JavaScript code will be of more importance, testing techniques for the language remain insufficient, compared to other languages. We propose a technique to automatically generate high-coverage unit te...
متن کاملDOM Transactions for Testing JavaScript
Unit testing in the presence of side e ects requires the construction of a suitable test xture before each test run. We consider the problem of providing test xtures for unit testing of client-side JavaScript code that manipulates its underlying web page. We propose using techniques from software transactional memory to restore the test xture after each test run.
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2015